home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / acpi / sleep.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2006-10-15  |  1.2 KB  |  55 lines

  1. #!/bin/bash
  2.  
  3. . /etc/default/acpi-support
  4. . /usr/share/acpi-support/power-funcs
  5. . /usr/share/acpi-support/device-funcs
  6. . /usr/share/acpi-support/policy-funcs
  7.  
  8. DeviceConfig;
  9.  
  10. if [ x$ACPI_SLEEP != xtrue ] && [ x$1 != xforce ]; then
  11.   exit;
  12. fi
  13.  
  14. # If gnome-power-manager or klaptopdaemon are running, let them handle policy
  15. if [ x$1 != xforce ] && [ x$1 != xsleep ] && [ `CheckPolicy` = 0 ]; then
  16.     exit;
  17. fi
  18.  
  19. if [ x$LOCK_SCREEN = xtrue ]; then
  20.     if pidof xscreensaver > /dev/null; then 
  21.     for x in /tmp/.X11-unix/*; do
  22.         displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
  23.         getXuser;
  24.         if [ x"$XAUTHORITY" != x"" ]; then        
  25.         export DISPLAY=":$displaynum"
  26.         . /usr/share/acpi-support/screenblank
  27.         fi
  28.     done
  29.     fi
  30. fi
  31.  
  32. # Generic preparation code
  33. . /etc/acpi/prepare.sh
  34.  
  35. if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
  36.   hdparm -d 0 /dev/hda
  37. fi
  38.  
  39. echo -n $ACPI_SLEEP_MODE >/sys/power/state
  40.  
  41. if [ x$RESET_DRIVE = xtrue ] && [ -b /dev/hda ]; then
  42.     hdparm -w /dev/hda
  43.     hdparm -C /dev/hda
  44.     hdparm -C /dev/hda
  45.     hdparm -C /dev/hda
  46.     hdparm -d 1 /dev/hda
  47. fi
  48.  
  49. if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
  50.   hdparm -d 1 /dev/hda
  51. fi
  52.  
  53. # Generic wakeup code
  54. . /etc/acpi/resume.sh
  55.